package code.c06;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/10/13 10:36
 * @package code.c06
 * @description 再论多态
 */

public class Fathers {
    String var = "FatherVar";
    static String staticVar = "StaticFatherVar";

    void method() {
        System.out.println("Father method");
    }

    static void staticMethod() {
        System.out.println("Static Father method");
    }
}

class Sons extends Fathers {
    String var = "SonVar";
    static String staticVar = "StaticSonVar";

    void method() {
        System.out.println("Son method");
    }

    static void staticMethod() {
        System.out.println("Static Son method");
    }

    String sonVar = null;

    void sonMethod() {
    }
}
class Tester{
    public void test(){
        Fathers f=new Sons();
        //Fathers f=new Fathers();
        //Sons f=new Sons();
        //Sons f=(Sons)new Fathers();

        System.out.println(f.var);
        System.out.println(f.staticVar);
        f.method();
        f.staticMethod();
    }

    public static void main(String[] args){
        new Tester().test();
    }
}
